package design.structure.代理;

/**
 * 静态  汽车代理
 */
public class CarProxy implements BuyCar {
    private BuyCar buyCar;

    CarProxy(BuyCar buyCar) {
        this.buyCar = buyCar;
    }

    @Override
    public void buyCar() {
        System.out.println("买车前");
        buyCar.buyCar();
        System.out.println("买车后");
    }

    @Override
    public int askPrice(int price) {
        System.out.println("问价-----");
        int sum = buyCar.askPrice(price);
        System.out.println("问价+++++");
        return sum;
    }
}
